package com.away.transaction;

import com.away.sequence.OrderEntity;
import com.away.sequence.SequenceProducerController;
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.MessageQueueSelector;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@SpringBootApplication
@RequestMapping("/transactionProducerController")
public class TransactionProducerController {

    @Autowired
    OrderTransactionService service;

    @GetMapping("sendMsg2MQ")
    public String sendMsg2MQ(){
        String orderId = System.currentTimeMillis() + "";
        String orderInfo = "testInfo";
        service.saveOrder(orderId,orderInfo);


        return "SUCCESS";
    }
    public static void main(String[] args) {
        SpringApplication.run(TransactionProducerController.class);
    }
}
